Skip to content

Conversation

cclauss
Copy link
Contributor

@cclauss cclauss commented Jan 10, 2020

Identity is not the same thing as equality in Python so use ==/!= to compare str, bytes, and int literals. In Python >= 3.8, these instances will raise SyntaxWarnings so it is best to fix them now. https://docs.python.org/3.8/whatsnew/3.8.html#porting-to-python-3-8

% python

>>> consumer = "cons"
>>> consumer += "umer"
>>> consumer == "consumer"
True
>>> consumer is "consumer"
False
>>> 0 == 0.0
True
>>> 0 is 0.0
False

This change is Reviewable

Identity is not the same thing as equality in Python so use ==/!= to compare str, bytes, and int literals. In Python >= 3.8, these instances will raise __SyntaxWarnings__ so it is best to fix them now. https://docs.python.org/3.8/whatsnew/3.8.html#porting-to-python-3-8

% __python__
```
>>> consumer = "cons"
>>> consumer += "umer"
>>> consumer == "consumer"
True
>>> consumer is "consumer"
False
>>> 0 == 0.0
True
>>> 0 is 0.0
False
```
@jeffwidman jeffwidman merged commit 7008fd4 into dpkp:master Feb 5, 2020
@cclauss cclauss deleted the patch-3 branch February 6, 2020 15:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants